define(["jquery", "easy-admin"], function ($, ea) {
    let uid = $("#ddd").val();
    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'authorize/index?uid='+uid,
        add_url: 'authorize/add',
        edit_url: 'authorize/edit',
        delete_url: 'authorize/delete',
        export_url: 'authorize/export',
        modify_url: 'authorize/modify',
    };
    var Controller = {
        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {field: 'merchant_name', title: '商户名称'},
                    {field: 'main_image', minWidth: 80, title: '图片', search: false, templet: ea.table.image}, 
                    {field: 'phone', title: '联系电话'},
                    {field: 'create_time', title: '入驻时间', search: false},
                    {
                        width: 100,
                        title: '操作',
                        templet: function (d) {
                            return '<a class="layui-btn layui-btn-success layui-btn-xs" data-request="authorize/addsq?mid='+d.id+'&vid='+uid+'" data-title="确定授权？">授权</a>';
                            // if (d.status == 1) {
                            //     return "";
                            // }else{
                            //     return "";
                            // }
                        },
                    }

                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});